package com.yuandengta.yomall.gateway.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.security.PublicKey;

/**
 * JWT属性类 {@link JwtProperties}
 */
@Configuration
@RefreshScope
@ConfigurationProperties(prefix = "auth.jwt")
@Slf4j
@Data
public class JwtProperties {

    private String pubKeyPath;

    private PublicKey publicKey;

    private String cookieName;

    @PostConstruct
    public void init() {
//        try {
//            // 获取公钥
//            this.publicKey = RsaUtils.getPublicKey(pubKeyPath);
//        } catch (Exception e) {
//            log.error("初始化公钥失败！", e);
//            throw new RuntimeException();
//        }
    }
}
